#include "PlanePrim.h"

PlanePrim::PlanePrim() : Primitive(), m_Plane()
{
} // Zero-argument constructor

PlanePrim::PlanePrim(Math::Vector pos, Math::Vector normal) : Primitive(pos, normal), m_Plane(pos, normal)
{
} // Constructor

PlanePrim::~PlanePrim()
{
} // Destructeur

bool PlanePrim::intersects(Math::Ray &ray, float& distance, bool second)
{
    Math::Vector r= (second) ? (m_Position - ray.getPosition()) : m_VVector;
	return m_Plane.intersects(ray, distance, r);
} // intersects

int PlanePrim::intersects(Math::Plane &plane, float &distance)
{
	return INTERSECTS;
} // intersects

void PlanePrim::calculatesConstants(Math::Vector &pos)
{
	m_VVector = m_Position-pos;
}

void PlanePrim::getIntersectionParams(Math::Ray &ray, const float t, Math::Vector *normal, Math::Vector *uv){
    m_Plane.getIntersectionParams(ray,t,normal,uv);
}